﻿using System.Collections.Generic;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MyCompany.WebCrawler.Repositories;

namespace MyCompany.WebCrawler.Test.RepositoryTest.Given_Database
{
    [TestClass]
    public class When_SaveUrl : Context
    {
        private Repository repository;
        private string url = "http://google.com";
        private List<Url> links;

        public override void Arrange()
        {
            repository = new Repository();
            repository.Clean();
        }

        public override void Act()
        {
            repository.Save(url);
            links = repository.Load();
        }

        [TestMethod]
        public void Then_UrlInDataBase()
        {
            links[0].Path.Should().Be(url);
        }
    }
}